<?php
/**
 * 商场号码管理
 * @author ice<iceinto@mallog.com.cn>
 */
class PhoneAction extends CommonAction
{
    public function _initialize()
    {
        parent::_initialize();
        if ($this->_role['role_id'] != 5) {
            $this->errorLang('_NOT_ACCESS');
        }
        $this->assign('nav', 11);
    }

    public function index()
    {
        //获取商场列表
        $MallModel = D('Mall');
        $malls = $MallModel->getList();
        $this->assign('malls', $malls);
        $this->display();
    }

    /**
     * 获取商场楼层信息
     * @author ice <iceinto@mallog.com.cn>
     */
    public function getFloors()
    {
        $mid = intval(getGet('mid'));
        $floors = D('Mall')->getFloorList($mid, 'id,mid,sain as name');
        $this->assign('floors', $floors);
        $this->assign('mid', $mid);
        $this->ajaxReturn($this->fetch(), null, 1);
    }

    /**
     * 获取商场楼层品牌
     * @author ice <iceinto@mallog.com.cn>
     */
    public function getBrands()
    {
        $brands = array();
        $status = 1;
        $fid = intval(getGet('fid'));
        $brands = D('Mall')->getFloorBrandList($fid);

        $this->assign('fid', $fid);
        $this->assign('brands', $brands);
        $this->ajaxReturn($this->fetch(), null, $status);
    }

    /**
     * 获取对应号码管理
     * @author ice <iceinto@mallog.com.cn>
     */
    public function getPhones()
    {
        $mid = intval(getGet('mid'));
        $fid = intval(getGet('fid'));
        $bid = intval(getGet('bid'));
        if(empty($mid)){
            $this->ajaxReturn('楼层信息必须！', null, 0);
        }
        $MallPhoneModel = D('MallPhone');
        $phones = $MallPhoneModel->geFloorList($mid, $fid, $bid);
        $this->assign('phones', $phones);
        $this->ajaxReturn($this->fetch(), null, 1);
    }
}

?>